
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<%@page import="com.tss.util.*"%>
<%@page import="com.jedi.*"%>
<%@page import="com.store.*"%>
<%@page import="java.util.*"%>
<%@page import="java.text.*"%>
<%@include file="../global_var.jsp"%>
<%@include file="../check_login.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

User just_user = (User)session.getAttribute("LoginUser");
if (!just_user.hasPower("10807")) {
	out.println(strNoPowerInfo); 
	return;
}
MessageMgr msgMgr = new MessageMgr();
List list = null;
int count=1;
%>
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<link href="style/main.css" rel="stylesheet" type="text/css">
<script language="javascript" src="js/common.js"></script>
<script language="javascript">
function clk_reply_btn(msg_id) {
	location.href = "knowledge_msg_reply.jsp?id=" + msg_id;
}

function clk_delete_btn(msg_id) {
	ifrmActiveArea.location.href = "knowledge_msg_delete.jsp?id=" + msg_id;
}
</script>
</head>

<body 	leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td style="padding-left:25px;">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td height="31" valign="top" background="images/title_bk_01.gif"
					style="padding-left:10px;padding-top:6px;">
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td width="50%" style="color:#FFFFFF;font-size:13px;"><b>知识库</b>
						-&gt; <b>咨询列表</b></td>
						<td width="50%" align="right" style="padding-right:10px;">&nbsp; <span
							onclick="right_menu_clk('knowledge_msg_add.jsp');"
							style="cursor:hand;color:#FFFFFF;font-size:12px;text-de--ation: underline;">我要提问</span>
						</td>
					</tr>
				</table>
				</td>
			</tr>
			<tr>
				<td height="100" align="right" valign="top"
					style="padding-top:12px;padding-bottom:10px;"><%
            String otherSQL = "";
            String orderField = "reply_id desc,issue_time";
            int pageSize = 10;
            int pageNo = ParamUtils.getIntParameter(request,"page",1);
            list = msgMgr.get(otherSQL,orderField,pageNo,pageSize);
            int total = msgMgr.getTotal(); 
            boolean b=(total % pageSize ==0);
            int pageCount=b?(total/pageSize):(total/pageSize +1);
            if(pageNo>pageCount){
            	pageNo=pageCount;
            }
            if (list != null && list.size() > 0) {
            	for(int i=0;i<list.size();i++) {
            		com.jedi.Message msgItem = (Message)list.get(i);
            		if (msgItem.getMsgType() == 0) {
            %>
				<table width="100%" border="0" cellpadding="0" cellspacing="1"
					bgcolor="#FFFFFF">
					<tr bgcolor="#858585">
						<td height="24" colspan="4"
							style="padding-left:10px;color:#FFFFFF;"><b>ＮＯ: <%=(pageNo-1) * pageSize + 1 + i%>
						&nbsp; <%=msgItem.getMsgTitle()%></b></td>
					</tr>
					<tr>
						<td width="20%" rowspan="2" bgcolor="#D7D7DB" align="center"><%=msgItem.getAuthorName()%></td>
						<td height="60" colspan="4" valign="top" bgcolor="#EDEDF0"
							style="padding:4px 4px 4px 4px;"><%=msgItem.getMsgInfo().replaceAll("\n","<br>")%></td>
					</tr>
					<tr>
						<td width="45%" bgcolor="#EDEDF0" height="24"
							style="padding-left:10px;"><%=msgItem.getIssueTime()%></td>
						<td width="10%" bgcolor="#EDEDF0" align="center"><span
							style="text-decoration: underline;cursor:hand;"
							onclick="clk_delete_btn('<%=msgItem.getId()%>');">删除</span></td>
						<td width="25%" align="center" bgcolor="#EDEDF0">回复数：<%=msgItem.getReplyNum()%>
						&nbsp; <span style="text-decoration: underline;cursor:hand;"
							onclick="clk_reply_btn('<%=msgItem.getId()%>');">回复</span></td>
					</tr>
				</table>
				<%		}else{%>
				<table width="100%" border="0" cellpadding="4" cellspacing="1"
					bgcolor="#FFFFFF">
				<tr bgcolor="#858585">
						<td width="65%" height="24" style="padding-left:10px;color:#FFFFFF;"><b>回复: <%=count%>
						&nbsp; <%=msgItem.getMsgTitle()%></td>
						<td width="10%" align="center"><span
							style="text-decoration: underline;cursor:hand;"
							onclick="clk_delete_btn('<%=msgItem.getId()%>');">删除</span></td>
						<td width="25%" height="24" align="center"><%=msgItem.getIssueTime()%></td>
					</tr>
				</table>
				<table width="100%" border="0" cellpadding="4" cellspacing="1"
					bgcolor="#FFFFFF">
					<tr>
						<td width="20%" bgcolor="#D7D7DB" align="center"><%=msgItem.getAuthorName()%></td>
						<td height="60" valign="top" bgcolor="#EDEDF0"><%=msgItem.getMsgInfo()%></td>
					</tr>
				</table>
				<%	count++;		}%> <%	}%>
				<form name="pageForm" method="post">
				<table width="100%" border="0" cellpadding="0" cellspacing="0"
					background="images/page_img/page_bk.gif">
					
					<tr height="32" align="center" valign="bottom">
						<td width="5%"><img src="images/page_img/page_tag_01.gif"></td>
						<td height="35" align="right" style="padding-right:10px;"
							valign="bottom" id="pannelPageInfo">&nbsp;</td>
					</tr>
				
				</table>
					</form>
				<script language="javascript">
            pannelPageInfo.innerHTML = getPageInfo(<%=total%>,<%=pageSize%>,<%=pageNo%>,5,'images/page_img','pageForm');
            </script> <%}else{%>
				<table width="95%" border="0" cellpadding="4" cellspacing="1"
					bgcolor="#FFFFFF">
					<tr>
						<td height="60" align="center">目前没有任何咨询信息!</td>
					</tr>
				</table>
				<%}%></td>
			</tr>
		</table>
		</td>
	</tr>
</table>
<iframe id="ifrmActiveArea" name="ifrmActiveArea" frameborder="0"
	width="1" height="1" scrolling="no"></iframe>
</body>
</html>
